package tech.aistar.mapper.deamnd;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tech.aistar.entity.Picture;

import java.util.List;

/**
 * Created by 豆梦寒 on 2019/9/27.
 */
@Repository
public interface PictureMapper {

    /**
     * 根据id查找名称
     * @param id
     */
    @Select("select * from picture where id = #{value}")
    Picture findPathById(Integer id);

    /**
     * 根据id进行删除
     * @param id
     */
    @Update("update picture set status = 1 where id = #{value}")
    void delPathById(Integer id);

    /**
     * 根据id进行添加
     * @param picture
     */
    @Insert("insert into picture (path,status) values(#{path},#{status})")
    void addPathById(Picture picture);

    /**
     * 根据id进行更改
     * @param picture
     */
    @Update("update picture set path=#{path},status=#{status} where id = #{id}")
    void updatepicture(Picture picture);

    /**
     * 通过id查询全部
     * @param
     * @return
     */
    @Select("select * from picture")
    List<Picture> findById();


    //修改部分
    void updateOne(Picture picture);
}
